package main

import "fmt"

func main() {
	fmt.Println(GFmul_8(109, 62))
	// a := GenarateUnit_8()
	// fmt.Println(len(a), a)
	exp, log := GenerateMulTab_8(3)
	// fmt.Println(exp)
	// fmt.Println(log)
	fmt.Println(GFmulTab_8(exp, log, 109, 62))
	// tab := GenerateInvTab_8(exp, log)
	fmt.Println(GenerateInvTab_8(exp, log))

	a := []uint8{25, 35, 35, 16, 125, 16, 125, 78, 78, 25}
	var x, y uint8

	for i := 0; i < len(a); i++ {
		x = x ^ a[i]
	}
	for i := 0; i < len(a); i++ {
		y = y ^ GFmul_8(a[i], a[i])
		fmt.Println(y)
	}
	for i := 0; i < 256; i++ {
		if GFmul_8(uint8(i), uint8(i))^GFmul_8(uint8(i)^x, uint8(i)^x) == y {
			fmt.Println(GFmul_8(uint8(i), uint8(i)))
			fmt.Println(GFmul_8(uint8(i)^x, uint8(i)^x))
			fmt.Println(i)
			break
		}
	}
}
